﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script src="~/scripts/jquery.js"></script>
    <script src="~/scripts/jquery.validate.js"></script>
    <script src="~/scripts/messages_zh.js"></script>
   
</head>
<body>
    @using (Html.BeginForm())
    {
        <p>
            用户名： <input type="text" id="username" name="username"  />
         
        </p>
        <p>密码：<input type="password" id="password" /></p>
        <p>确认密码<input type="password" id="password2" name="password2" /></p>

        <button type="submit">提交</button>
    }
    <script>
        $(document).ready(function () {
            $("form").validate({
                rules: {
                    username: { required: true },
                    password: { required: true },
                    password2: { required: true,equalTo:"#password" }
                },
                messages: {
                    username: { required: "请输入用户名" },
                    password: { required: "请输入密码" },
                    password2: {
                        required: "请输入正确密码",equalTo:"两次密码不一致"
                    }
                }
            })
        })
      
    </script>
</body>
</html>
